function [Outputs,Fnk]=RFNNpro_v(S,W)

    %coder.inline("never");

    % 参数初始化
    numInputs=size(S,2);% 输入层节点数
    numMFsPerInput=2;% 每个输入的隶属度函数数
    numRules=16;% 模糊规则数
    numOutputs=2;% 输出层节点数
    % 初始化静态变量
    persistent pre_firingStrengths;
    if isempty(pre_firingStrengths)
            pre_firingStrengths =zeros(1,numRules);
    end
    %训练均值和标准差
    c=[0,0,-pi/2,-pi/2;
        10,4,pi/2,pi/2];
%     sigma=[4.3,1.6,1.3,1.3];%v,w
    sigma=[5,1,1,1];%v,w
    % 隶属度层
    MFs = zeros(numMFsPerInput, numInputs);
    for i = 1:numInputs
        for j = 1:numMFsPerInput
            % 定义高斯隶属度函数的参数
            c_ij= c(j,i);%均值
            sigma_ij= sigma(i);%v标准差
            MFs(j, i) = exp(-((S(i)-c_ij)^2)/(sigma_ij^2));
        end
    end
    % 模糊规则层
    firingStrengths=ones(1, numRules);
    for r = 1:numRules
        % 计算每条规则的激活程度（AND操作）
        switch r
            case 1
%                 firingStrengths(r)=min([MFs(1,1),MFs(1,2),MFs(1,3),MFs(1,4)]);%near near right right
                firingStrengths(r)=MFs(1,1)*MFs(1,2)*MFs(1,3)*MFs(1,4);
            case 2
%                 firingStrengths(r)=min([MFs(1,1),MFs(1,2),MFs(1,3),MFs(2,4)]);%near near right left
                firingStrengths(r)=MFs(1,1)*MFs(1,2)*MFs(1,3)*MFs(2,4);
            case 3
%                 firingStrengths(r)=min([MFs(1,1),MFs(1,2),MFs(2,3),MFs(1,4)]);%near near left right
                firingStrengths(r)=MFs(1,1)*MFs(1,2)*MFs(2,3)*MFs(1,4);
            case 4
%                 firingStrengths(r)=min([MFs(1,1),MFs(1,2),MFs(2,3),MFs(2,4)]);%near near left left
                firingStrengths(r)=MFs(1,1)*MFs(1,2)*MFs(2,3)*MFs(2,4);
            case 5
%                 firingStrengths(r)=min([MFs(1,1),MFs(2,2),MFs(1,3),MFs(1,4)]);%near far right right
                firingStrengths(r)=MFs(1,1)*MFs(2,2)*MFs(1,3)*MFs(1,4);
            case 6
%                 firingStrengths(r)=min([MFs(1,1),MFs(2,2),MFs(1,3),MFs(2,4)]);%near far right left
                firingStrengths(r)=MFs(1,1)*MFs(2,2)*MFs(1,3)*MFs(2,4);
            case 7
%                 firingStrengths(r)=min([MFs(1,1),MFs(2,2),MFs(2,3),MFs(1,4)]);%near far left right
                firingStrengths(r)=MFs(1,1)*MFs(2,2)*MFs(2,3)*MFs(1,4);
            case 8
%                 firingStrengths(r)=min([MFs(1,1),MFs(2,2),MFs(2,3),MFs(2,4)]);%near far left left
                firingStrengths(r)=MFs(1,1)*MFs(2,2)*MFs(2,3)*MFs(2,4);
            case 9
%                 firingStrengths(r)=min([MFs(2,1),MFs(1,2),MFs(1,3),MFs(1,4)]);%far near right right
                firingStrengths(r)=MFs(2,1)*MFs(1,2)*MFs(1,3)*MFs(1,4);
            case 10
%                 firingStrengths(r)=min([MFs(2,1),MFs(1,2),MFs(1,3),MFs(2,4)]);%far near right left
                firingStrengths(r)=MFs(2,1)*MFs(1,2)*MFs(1,3)*MFs(2,4);
            case 11
%                 firingStrengths(r)=min([MFs(2,1),MFs(1,2),MFs(2,3),MFs(1,4)]);%far near left right
                firingStrengths(r)=MFs(2,1)*MFs(1,2)*MFs(2,3)*MFs(1,4);
            case 12
%                 firingStrengths(r)=min([MFs(2,1),MFs(1,2),MFs(2,3),MFs(2,4)]);%far near left left
                firingStrengths(r)=MFs(2,1)*MFs(1,2)*MFs(2,3)*MFs(2,4);
            case 13
%                 firingStrengths(r)=min([MFs(2,1),MFs(2,2),MFs(1,3),MFs(1,4)]);%far far right right
                firingStrengths(r)=MFs(2,1)*MFs(2,2)*MFs(1,3)*MFs(1,4);
            case 14
%                 firingStrengths(r)=min([MFs(2,1),MFs(2,2),MFs(1,3),MFs(2,4)]);%far far right left
                firingStrengths(r)=MFs(2,1)*MFs(2,2)*MFs(1,3)*MFs(2,4);
            case 15
%                 firingStrengths(r)=min([MFs(2,1),MFs(2,2),MFs(2,3),MFs(1,4)]);%far far left right
                firingStrengths(r)=MFs(2,1)*MFs(2,2)*MFs(2,3)*MFs(1,4);
            case 16
%                 firingStrengths(r)=min([MFs(2,1),MFs(2,2),MFs(2,3),MFs(2,4)]);%far far left left
                firingStrengths(r)=MFs(2,1)*MFs(2,2)*MFs(2,3)*MFs(2,4);
        end
    end
%     firingStrengths=round(firingStrengths,3);
    firing_total=sum(firingStrengths);
    now_firingStrengths=firingStrengths/firing_total;
%     now_firingStrengths=firingStrengths;
%     time_delay=zeros(1,numRules);
%     now_firingStrengths=(ones(1,numRules)-time_delay).*firingStrengths+time_delay.*pre_firingStrengths;
    Fnk=now_firingStrengths;
    pre_firingStrengths=now_firingStrengths;
    %后件层
%     [rulesOn,i]=max(now_firingStrengths);
%     Outputs=rulesOn*W(:,i);
    Outputs = zeros(numOutputs, 1);
    for o = 1:numOutputs
        for r = 1:numRules
            % 线性组合
            Outputs(o) = Outputs(o) + now_firingStrengths(r) * W(o, r);
        end
    end
end